package com.jy.wms.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import com.jy.wms.common.base.BaseController;
import com.jy.wms.common.base.JsonResult;
import com.jy.wms.pojo.WmsStockFrozenOperation;
import com.jy.wms.service.WmsStockFrozenOperationService;

import javax.servlet.http.HttpSession;

import com.github.pagehelper.Page;
import com.jy.wms.common.base.ResultPage;

import java.util.List;

import com.jy.wms.common.UUIDUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

/**
 * @ClassName: WmsStockFrozenOperationController
 * @Description: 库存冻结操作记录
 * @Author Yjs
 * @Date Fri Dec 01 10:40:00 GMT+08:00 2017
 */
@RestController
@RequestMapping("/wmsstockfrozenoperation")
@Api(value = "/wmsstockfrozenoperation", description = "")
public class WmsStockFrozenOperationController extends BaseController<WmsStockFrozenOperationService, WmsStockFrozenOperation> {

    @PostMapping(value = {"list"})
    @ApiOperation(value = "查询信息", response = JSONObject.class, notes = "查询信息")
    public @ResponseBody
    ResultPage<WmsStockFrozenOperation> getWmsStockFrozenOperation(@RequestBody WmsStockFrozenOperation entity, HttpSession session) {
        Page<WmsStockFrozenOperation> list = baseService.baseSelectPage(entity);
        return renderPage(list);
    }

    @PostMapping(value = "delete")
    @ApiOperation(value = "删除信息", response = JSONObject.class, notes = "删除信息")
    public @ResponseBody
    JsonResult deleteWmsStockFrozenOperation(@RequestBody List<String> ids) {
        Integer flag = baseService.baseDeleteBathPrimaryKeys(ids);
        return renderSuccess("删除成功");
    }

    @PostMapping(value = "add")
    @ApiOperation(value = "新增信息", response = JSONObject.class, notes = "新增信息")
    public @ResponseBody
    JsonResult addWmsStockFrozenOperation(@RequestBody WmsStockFrozenOperation entity) {
        entity.setId(UUIDUtils.uuid());
        baseService.baseInsert(entity);
        return renderSuccess("添加成功");
    }

    @GetMapping(value = "getWmsStockFrozenOperation/{id}")
    @ApiOperation(value = "查看单个信息", response = JSONObject.class, notes = "GET查看单个信息")
    public @ResponseBody
    WmsStockFrozenOperation getWmsStockFrozenOperationById(@PathVariable("id") String id) {
        WmsStockFrozenOperation entity = baseService.baseSelectByPrimaryKey(id);
        return entity;
    }

    @PostMapping(value = "edit")
    @ApiOperation(value = "编辑信息", response = JSONObject.class, notes = "编辑信息")
    public @ResponseBody
    JsonResult editWmsStockFrozenOperation(@RequestBody WmsStockFrozenOperation entity) {
        Integer flag = baseService.baseUpdateByPrimaryKeySelective(entity);
        return renderSuccess("修改成功");
    }
}
